package progma.lang.compiler;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;

public class CompilerFileWriter {

	public static void writeFiles(HashMap<String, byte[]> files)
			throws IOException {
		for (String file : files.keySet()) {
			FileOutputStream fos = null;
			try {
				byte[] bytes = files.get(file);
				File f = new File("c:/tmp/cltest/" + file + ".class");
				f.createNewFile();
				fos = new FileOutputStream(f);
				fos.write(bytes);
			} catch (IOException e) {
				e.printStackTrace();
			} finally {
				if (fos != null)
					fos.close();
			}
		}
	}
}
